<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'business-model-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'customerSegment'); ?>
		<?php echo $form->dropdownlist($model,'customerSegment', BusinessModel::model()->getCustomerSegmentOptions())?>	
		<?php echo $form->error($model,'customerSegment'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'scale'); ?>
		<?php echo $form->dropdownlist($model,'scale', BusinessModel::model()->getScaleOptions())?>
		<?php echo $form->error($model,'scale'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'focus'); ?>
        <?php echo $form->dropdownlist($model,'focus', BusinessModel::model()->getFocusOptions())?>
		<?php echo $form->error($model,'focus'); ?>
	</div>

	<!-- enter businessResources of current business -->
    <div class="row">
        <?php echo $form->labelEx($model,'tblPartnership'); ?>
        
        <div class='checkboxes'>
        
                <?php 
                        if ($model->tblPartnership == null)
                        {
                                echo $form->checkBoxList($model, 'tblPartnership',
                        CHtml::listData(Partnership::model()->findAll(), 'id', 'type'),
                        array('attributeitem' => 'id','separator'=>'<br>','labelOptions'=>array('style'=>'display:inline')) );
                        }
                        else 
                        {
                                $model2 = new BusinessModel();
                                
                                $partnershipArray = array();
                                
                                foreach ($model->tblPartnership as $partnership)
                                {
                                        array_push($partnershipArray, $partnership->id);
                                }
                                $model2->tblPartnership = $partnershipArray;


                                echo $form->checkBoxList($model2, 'tblPartnership',
                        CHtml::listData(Partnership::model()->findAll(), 'id', 'type'),
                        array('attributeitem' => 'id','separator'=>'<br>','labelOptions'=>array('style'=>'display:inline')) );
                        
                        }
                ?>
    </div>
        <?php echo $form->error($model,'tblPartnership'); ?>
        </div>
	
	<!-- enter businessResources of current business -->
    <div class="row">
        <?php echo $form->labelEx($model,'tblRevenuestreams'); ?>
        
        <div class='checkboxes'>
        
                <?php 
                        if ($model->tblRevenuestreams == null)
                        {
                                echo $form->checkBoxList($model, 'tblRevenuestreams',
                        CHtml::listData(RevenueStreams::model()->findAll(), 'id', 'name'),
                        array('attributeitem' => 'id','separator'=>'<br>','labelOptions'=>array('style'=>'display:inline')) );
                        }
                        else 
                        {
                                $model2 = new BusinessModel();
                                
                                $revenuestreamsArray = array();
                                
                                foreach ($model->tblRevenuestreams as $revenuestream)
                                {
                                        array_push($revenuestreamsArray, $revenuestream->id);
                                }
                                $model2->tblRevenuestreams = $revenuestreamsArray;


                                echo $form->checkBoxList($model2, 'tblRevenuestreams',
                        CHtml::listData(RevenueStreams::model()->findAll(), 'id', 'name'),
                        array('attributeitem' => 'id','separator'=>'<br>','labelOptions'=>array('style'=>'display:inline')) );
                        
                        }
                ?>
    </div>
        <?php echo $form->error($model,'tblRevenueStreams'); ?>
        </div>
        
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->